home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CUCD / Programming / OUI / rcs / palette.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.4 KB  |  134 lines

  1. head    1.3;
  2. access;
  3. symbols;
  4. locks
  5.     dlorre:1.3; strict;
  6. comment    @// @;
  7.  
  8.  
  9. 1.3
  10. date    98.01.13.20.01.29;    author dlorre;    state Exp;
  11. branches;
  12. next    1.2;
  13.  
  14. 1.2
  15. date    97.07.14.04.22.39;    author dlorre;    state Exp;
  16. branches;
  17. next    1.1;
  18.  
  19. 1.1
  20. date    96.08.22.02.05.10;    author dlorre;    state Exp;
  21. branches;
  22. next    ;
  23.  
  24.  
  25. desc
  26. @Oui.lib -- Object User Interface
  27. Projet créé en 1994
  28. Auteur: Dominique Lorre
  29. @
  30.  
  31.  
  32. 1.3
  33. log
  34. @changed default settings
  35. @
  36. text
  37. @// $Id: palette.cc 1.2 1997/07/14 04:22:39 dlorre Exp dlorre $
  38. #include <libraries/gadtools.h>
  39.  
  40. #include "gadgets/palette.h"
  41. #include "gadgetlist.h"
  42.  
  43. #include <proto/gadtools.h>
  44.  
  45. // ========================================================================
  46. // ===========================  PALETTE CLASS =============================
  47. // ========================================================================
  48.  
  49.  
  50. palette::palette(gadgetlist *gl,
  51.                 void (window::*func)(gadget *, unsigned long, unsigned short),
  52.                 const char *text,
  53.                 long depth,
  54.                 long offset,
  55.                 long pen,
  56.                 long place,
  57.                 short iwidth, short iheight) : gadget(gl, func)
  58. {
  59.     gl->ng->ng_Flags = place ;
  60.     gl->ng->ng_GadgetText = (UBYTE *)text ;
  61.     gad = gl->gad = (Gadget *)CreateGadget(PALETTE_KIND, gl->gad, gl->ng,
  62.         GTPA_Depth, depth,
  63.         GTPA_ColorOffset, offset,
  64.         GTPA_Color,     pen,
  65.         GTPA_IndicatorWidth, iwidth,
  66.         GTPA_IndicatorHeight, iheight,
  67.         GT_Underscore,  '_',
  68.         TAG_END) ;
  69. }
  70.  
  71. void palette::action(unsigned long classe, unsigned short code)
  72. {
  73.     cursel = code ;
  74.     gadget::action(classe, code) ;
  75. }
  76.  
  77. void palette::set(long sel)
  78. {
  79.     cursel = sel ;
  80.     GT_SetGadgetAttrs(gad, w, NULL,
  81.         GTPA_Color, cursel,
  82.         TAG_DONE) ;
  83. }
  84.  
  85. void palette::keystroke(BOOL shifted)
  86. {
  87.     if (shifted) {
  88.         if (cursel) cursel-- ;
  89.     }
  90.     else {
  91.         if (cursel < (numcolors-1)) cursel++ ;
  92.     }
  93.     gadget::action(NULL, cursel) ;
  94.     GT_SetGadgetAttrs(gad, w, NULL,
  95.         GTPA_Color, cursel,
  96.         TAG_DONE) ;
  97. }@
  98.  
  99.  
  100. 1.2
  101. log
  102. @*** empty log message ***
  103. @
  104. text
  105. @d1 1
  106. a1 1
  107. // $Id$
  108. d27 1
  109. a27 1
  110.         GTPA_ColorOffset, 0,
  111. d29 2
  112. a30 2
  113.         GTPA_IndicatorWidth, 20,
  114.         GTPA_IndicatorHeight, 10,
  115. @
  116.  
  117.  
  118. 1.1
  119. log
  120. @Initial revision
  121. @
  122. text
  123. @d1 1
  124. d7 1
  125. a7 1
  126. #include <cxxproto/gadtools.h>
  127. d16 1
  128. a16 1
  129.                 STRPTR text,
  130. d24 1
  131. a24 1
  132.     gl->ng->ng_GadgetText = text ;
  133. @
  134.